H264 H265 UDP and RTP Streaming
Appearance
Table of Contents
[Sticky]
Problems running the pipelines shown on this page? Please see our
GStreamer Debugging guide for help
.
Streaming
In this section we present some pipeline examples of how to stream video over the network using the udpsink element.
H264
The following pipelines generate a test video pattern, compress it using the H.264 codec, and stream it over UDP:
UDP with RTP
gst-launch-1.0 -e videotestsrc is-live=true ! 'video/x-raw, width=1920, height=1080, format=NV12, framerate=30/1' ! queue ! v4l2h264enc ! h264parse ! queue ! rtph264pay mtu=1400 ! queue ! udpsink host=127.0.0.1 port=5000
UDP without RTP
gst-launch-1.0 -e videotestsrc is-live=true ! 'video/x-raw, width=1920, height=1080, format=NV12, framerate=30/1' ! queue ! v4l2h264enc ! h264parse ! udpsink host=127.0.0.1 port=5000
UDP with Transport Stream
gst-launch-1.0 -e videotestsrc is-live=true ! 'video/x-raw, width=1920, height=1080, format=NV12, framerate=30/1' ! queue ! v4l2h264enc ! h264parse ! queue ! mpegtsmux ! queue ! udpsink host=127.0.0.1 port=5000
H265
The following pipelines create a test video feed, encode it in H.265 format with specific settings, and deliver it via UDP:
UDP with RTP
<syntaxhighlight lang="bash"> gst-launch-1.0 -e videotestsrc is-live=true ! 'video/x-raw, width=1920, height=1080, format=NV12, framerate=30/1' ! queue ! v4l2h265enc ! h265parse ! queue ! rtph265pay mtu=1400 ! queue ! udpsink host=127.0.0.1 port=5000
UDP without RTP
gst-launch-1.0 -e videotestsrc is-live=true ! 'video/x-raw, width=1920, height=1080, format=NV12, framerate=30/1' ! queue ! v4l2h265enc ! h265parse ! udpsink host=127.0.0.1 port=5000
UDP with Transport Stream
gst-launch-1.0 -e videotestsrc is-live=true ! 'video/x-raw, width=1920, height=1080, format=NV12, framerate=30/1' ! queue ! v4l2h265enc ! h265parse ! queue ! mpegtsmux ! queue ! udpsink host=127.0.0.1 port=5000
Clients
This section provides information about how to receive and display the UDP stream generated by the streaming pipelines, using GStreamer.
H264
UDP with RTP
gst-launch-1.0 udpsrc port=5000 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! h264parse ! queue ! v4l2h264dec ! queue ! autovideosink
UDP without RTP
gst-launch-1.0 -v udpsrc port=5000 caps='video/x-h264,stream-format=byte-stream,alignment=au' ! h264parse ! queue ! v4l2h264dec ! queue ! autovideosink
UDP with Transport Stream
gst-launch-1.0 udpsrc port=5000 ! tsdemux ! h264parse ! queue ! v4l2h264dec ! queue ! xvimagesink
H265
UDP with RTP
gst-launch-1.0 udpsrc port=5000 ! application/x-rtp,encoding-name=H265,payload=96 ! rtph265depay ! h265parse ! queue ! v4l2h265dec ! queue ! autovideosink
UDP without RTP
gst-launch-1.0 -v udpsrc port=5000 caps='video/x-h265,stream-format=byte-stream,alignment=au' ! h265parse ! queue ! v4l2h265dec ! queue ! autovideosink
UDP with Transport Stream
gst-launch-1.0 udpsrc port=5000 ! tsdemux ! h265parse ! queue ! v4l2h265dec ! queue ! xvimagesink